package cn.sylinx.horm.dialect.fs.builder;

import cn.sylinx.horm.dialect.fs.FS;

class DuckdbFS<T> extends FS<T> {

    public static <T> FS<T> of(Class<T> modelClass) {
        return new DuckdbFS<T>().init(modelClass);
    }

    public static <T> FS<T> of(Class<T> modelClass, String tablePostfix) {
        return new DuckdbFS<T>().init(modelClass, tablePostfix);
    }

    public static <T> FS<T> of(String tablePrefix, Class<T> modelClass) {
        return new DuckdbFS<T>().init(tablePrefix, modelClass);
    }

    public static <T> FS<T> of(String tablePrefix, Class<T> modelClass, String tablePostfix) {
        return new DuckdbFS<T>().init(tablePrefix, modelClass, tablePostfix);
    }

    @Override
    public FS<T> limit(int offset, int size) {
        if (limitSQL.length() == 0) {
            limitSQL.append(" LIMIT ").append(size).append(" OFFSET ").append(offset);
        }
        return this;
    }

}
